home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13971 < prev    next >
Encoding:
Text File  |  1996-08-05  |  834 b   |  31 lines

  1. Path: sed.psrw.com!psinntp!psinntp!psinntp!pipeline!not-for-mail
  2. From: luciferm@nyc.pipeline.com (manjila thapa)
  3. Newsgroups: comp.lang.c
  4. Subject: returning address of value to main
  5. Date: 10 Apr 1996 22:08:58 -0400
  6. Organization: The Pipeline
  7. Message-ID: <4khpjq$a3c@pipe1.nyc.pipeline.com>
  8. NNTP-Posting-Host: pipe1.nyc.pipeline.com
  9. X-Newsreader: TIN [version 1.2 PL1]
  10.  
  11. I want to return the address  of element of an array 
  12. a[0]....a[n]....a[m-1]          (address of a[n] is to be returned)
  13. from a function to the main so that:
  14.  
  15. main(){
  16. double *newarr;
  17. ...
  18. ...
  19. newarr= function(......) /*function is supposed to return address*/
  20. __________________________________________
  21. i tried 
  22.  
  23. return &a[n];
  24.  
  25. in function but it doesn't work! Isn't this the right way to get the
  26. address? (this is part of my hw, hope u don't mind) 
  27. thanks 
  28. manny
  29.  
  30.  
  31.